/* See LICENSE file for copyright and license details. */

#define MAX(A, B)               ((A) > (B) ? (A) : (B))
#define MIN(A, B)               ((A) < (B) ? (A) : (B))
#define BETWEEN(X, A, B)        ((A) <= (X) && (X) <= (B))

// #fmt 会拼接成 带双引号的 "fmt"
FILE *getlogfd();
#define TIME_STR_LEN 20
#define LOG_INFO(fmt, ...) do { \
    char timee[TIME_STR_LEN]; \
    get_time_str(timee, TIME_STR_LEN); \
    fprintf(getlogfd(), "[%s I] "fmt"\n",  timee, __VA_ARGS__); \
    fflush(getlogfd()); \
}while(0)
void loginit();
void get_time_str(char *, int);

void die(const char *fmt, ...);
void *ecalloc(size_t nmemb, size_t size);
